from sqlalchemy.dialects.mysql import INTEGER, VARCHAR,FLOAT,DOUBLE
from sqlalchemy import Column
from sqlalchemy.ext.declarative import declarative_base

from pydantic import BaseModel, ValidationError, validator
Base = declarative_base()


class EquipmentDrill(Base):
    __tablename__ = 'equipment_drill'

    id = Column(INTEGER, primary_key=True, autoincrement=True)
    equipment_id = Column(INTEGER,default=0)
    identifier = Column(VARCHAR(255),default='', nullable=False)
    channel = Column(VARCHAR(255), default='',nullable=False)
    type = Column(VARCHAR(255), default='',nullable=False)
    status = Column(INTEGER,default=0, nullable=False)
    x = Column(FLOAT(10,9), default=0,nullable=False)
    y = Column(FLOAT(10,9), default=0,nullable=False)
    z = Column(FLOAT(10,9), default=0,nullable=False)
    line = Column(VARCHAR(255), default='',nullable=False)
    create_time = Column(INTEGER, default=0)
    update_time = Column(INTEGER, default=0)

class Item(BaseModel):
    equipment_id: int
    identifier: str
    channel: str
    type: str
    x: float
    y: float
    z: float
    line:str

class UpdateInfo(BaseModel):
    drill_id:int
    equipment_id: int
    identifier: str
    channel: str
    type: str
    x: float
    y: float
    z: float
    line:str